import { reqCategoryData } from "../../api/category"

Page({

    data: {
        categoryList: [], //商品分类列表数据
        activeIndex: 0
    },

    //获取商品分类数据
    async getcategoryData() {
        const res = await reqCategoryData() 
        if (res.code === 200) {
            this.setData({
                categoryList: res.data
            })
        }
    },

    setActiveIndex(event) {
        const { index } = event.target.dataset

        this.setData({
            activeIndex: index
        })
    },

    onLoad() {
        this.getcategoryData()
    }
})
